<template>
  <div>
    <FilterTable
      ref="table"
      height="300"
      :isSelectColumn="false"
      :isColumnFilter="false"
      :columns="columns"
      :dataSource="rowData"
      :onColumnsChange="columns => (this.columns = columns)"
    >
    </FilterTable>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center'
      }"
    >
      <el-button @click="closeDrawer(1)">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';

export default {
  mixins: [dictionary],
  props: ['rowData'],

  data() {
    this.BaseTable = null;
    return {
      columns: this.createdTable(),
      tableList: []
    };
  },
  mounted() {},
  methods: {
    closeDrawer(type) {
      if (type == 1) {
        return this.$emit('close', false);
      }
    },

    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '折扣规则名称',
          dataIndex: 'ruleName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '折扣计算方式',
          dataIndex: 'discountMethod',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('6033'),
          render: props => {
            return <span>{this.createDictText(props.row.discountMethod, '6033')}</span>;
          }
        },
        {
          title: '折扣值',
          dataIndex: 'discountValue',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '动力形式',
          dataIndex: 'powerType',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('6008'),
          render: props => {
            return <span>{this.createDictText(props.row.powerType, '6008')}</span>;
          }
        }
      ];
    }
  }
};
</script>
